import {createRouter,createWebHistory} from "vue-router";
const router=createRouter({
    history:createWebHistory(),
    //对象数组，里面可以配置多个路由
    routes:[
        {
            path:'/',
            component:()=>
                import('../view/LoginView.vue')
        },
        {
            path:'/dashboard',
            component:()=>
                import('../view/DashboardView.vue'),
            //子路由
            children : [
                {
                    //路由转换-子路由路径不能以斜扛开头
                    path:'user',
                    component:()=>
                        import('../view/UserView.vue')
                },
                {
                    path:'user/:id',//id是动态变量，这个叫动态路由
                    component:()=>
                     import('../view/UserDetailView.vue')
                },
                {
                    path:'activity',
                    component:()=>
                        import('../view/ActivityView.vue')
                },
                {
                    path:'activity/add',
                    component:()=>
                        import('../view/ActivityRecordView.vue')
                },
                {
                    path: 'activity/edit/:id',//id是动态变量-动态路由
                    component:()=>
                        import('../view/ActivityRecordView.vue')
                },
                {
                    path: 'activity/:id',
                    component:()=>
                        import('../view/ActivityDetailView.vue')
                }
            ]
        },
    ]
})
export default router;
